//Vue配置

//引入APi 
import {createStore} from 'vuex';

import moduleA from './module/moduleA';
import moduleB from './module/moduleB';

//创建一个实例化的vuex对象
const store = createStore({
    modules:{
        a:moduleA,
        b:moduleB
    },
    state(){
        return{
            count:100
        }
    },
    getters:{
        tenTimes:(state)=>{
            return state.count *10
        }
    },
    mutations:{
        increment(state,payload){
            state.count =payload.count
        }
    },
    actions:{
        asyncIncrement(context,payload){
            console.log('context',context)
            context.commit("increment",payload)

        }
    }


})

export default store